package com.briup.pts.service.impl;

import com.briup.pts.mapper.QrcodeMapper;
import com.briup.pts.service.QrcodeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
public class QrcodeServiceImpl implements QrcodeService {
    private final QrcodeMapper mapper;

    @Override
    @Transactional
    public void addQrcode(String animalId, String url) {
        // 先根据动物id删除二维码数据
        mapper.deleteByAnimalId(animalId);
        // 在将内容添加到表中
        mapper.addQrcode(animalId, url);
    }
}